#include "sip_uac.h"

void* UACRegisterReq(UAContext* UContext, int expire_time)
{
	void* req = UAXMessageReq(SIP_MT_REGISTER, UContext->uac_code, UContext->uac_domain, UContext->uac_ip, UContext->uac_port,
		UContext->uas_code, UContext->uas_domain, UContext->uas_ip, UContext->uas_port, UContext->CSeq, UContext->protocol);
	UAXMessageHeader(req,"Expires", expire_time);
	return req;
}

void* UACHeartbeatReq(UAContext* UContext)
{
	char xml_body[512];
	int size = CreateHeartbeatXml(xml_body, UContext->uac_code);
	void* req = UAXMessageReq(SIP_MT_MESSAGE, UContext->uac_code, UContext->uac_domain, UContext->uac_ip, UContext->uac_port,
		UContext->uas_code, UContext->uas_domain, UContext->uas_ip, UContext->uas_port, UContext->CSeq, UContext->protocol);
	UAXMessageContent(req, MESSAGE_XML, xml_body, size);
    return req;
}

void* UACMessageRsp(void* sip, UAContext* UContext,  int status_code)
{
	void* req = UAXMessageRsp(sip, UContext->uac_code, UContext->uac_domain, UContext->uac_ip, UContext->uac_port,
		UContext->uas_code, UContext->uas_domain, UContext->uas_ip, UContext->uas_port, UContext->CSeq, UContext->protocol,status_code);
	return req;
}

void* UACQueryCatalogRsp(UAContext* UContext, CataDevice* item, const char* uac_code, int SumNum, int Num, int Notify)
{
	char xml_body[65536] = { 0 };
	int size = CreateCatalogXml(xml_body,item, uac_code,  SumNum,  Num,  Notify);

	void* req = UAXMessageReq(SIP_MT_MESSAGE, UContext->uac_code, UContext->uac_domain, UContext->uac_ip, UContext->uac_port,
		UContext->uas_code, UContext->uas_domain, UContext->uas_ip, UContext->uas_port, UContext->CSeq, UContext->protocol);

	UAXMessageContent(req, MESSAGE_XML, xml_body, size);
	return req;
}